package common

import "errors"

//define status

const (
	SystemAdmin  = 1 //系统内置的管理
	SpecialAdmin = 2 //系统内置角色用户
	OrdinaryUser = 3 //普通帐号

	Level1 = 1 //总代(一级代理)
	Level2 = 2 //二级代理
	Level3 = 3 //三级代理
	Level4 = 4 //四级代理

	TopUpLevel11 = 11
	TopUpLevel12 = 12

	H5SystemUserId = 0 //代理系统账号id
	PcSystemUserId = 0 //pc端管理的系统账号id

	/*-------------用户类型---------------------*/
	Agent  = 1 //代理
	Player = 2 //玩家
	/*-------------H5订单类型---------------------*/
	OrderDiamond  = 1 //购买钻石
	OrderAgentNum = 2 //购买代理名额

	/*------------平台类型----------------------*/
	PlatformPc     = 1 //1-pc后台管理系统
	PlatformH5     = 2 //2-代理助手系统
	PlatformClient = 3 //3-游戏客户端系统
	PlatformPf     = 4 //4-合伙人前端系统
	PlatformPb     = 5 //5-合伙人后台端系统

	/*------------系统帐号类型----------------------*/
	SysClientBuy  = 1 //客户端购买
	SysClientGive = 2 //客户端系统赠送
	SysH5Buy      = 3 //H5购买
	SysH5Give     = 4 //H5赠送

	SysClientBuyUid  = 1001 //客户端购买帐号
	SysClientGiveUid = 2001 //客户端赠送帐号
	SysH5BuyUid      = 3001 //助手端购买帐号
	SysH5GiveUid     = 4001 //助手端赠送帐号

	SysPfBuyUid  = 5001 //合伙人端购买帐号
	SysPfGiveUid = 6001 //合伙人端赠送帐号

	/*------------系统帐号钻石流出流入的操作类型----------------------*/
	SysOpAdd       = 1 //1-手动增加流入
	SysOpBuy       = 2 //2-购买流出
	SysOpBindPhone = 3 //3-绑定手机赠送流出
	SysOpActivity  = 4 //4-活动赠送流出
	SysOpHandOut   = 5 //5-手动赠送流出(后台直接修改玩家的数值)
	SysOpHandIn    = 6 //6-手动回收流入(后台直接修改玩家的数值)
	SysOpRegister  = 7 //7-玩家注册赠送流出
	SysOpBuyGive   = 8 //8-购买赠送流出

	/*-------------支付方式----------------------*/
	PayTypeIPay  = 1 //爱贝支付
	PayTypeFuBao = 2 //贝付宝支付

	/*---------------服务器状态-----------------*/
	ServerNormal = 1 //正常
	ServerStop   = 2 //停服
	ServerPanic  = 3 //异常

	/*-------------token的类型---------------------*/
	TokenH5     = 1
	TokenPc     = 2
	TokenClient = 3
	TokenPF     = 4 //合伙人系统
	TokenPB     = 5 //合伙人后台系统

	/*-------------支付方式-----------------------*/
	BalancePay = 1 //余额支付
	ApplePay   = 1 //苹果支付
	WeChatPay  = 2 //微信支付
	AliPay     = 3 //支付宝支付
	IPayPay    = 4 //爱贝支付
	/*-------------订单状态-----------------------*/
	OrderNotPay     = 1 //未支付
	OrderClosed     = 2 //订单已关闭
	OrderPayError   = 3 //支付异常,支付错误
	OrderPaySuccess = 4 //支付成功,但未发货
	OrderDelivered  = 5 //已发货

	//标识此订单是不是代理第一次充值买钻石
	FirstTimeBuyCard = 1 //第一次充值买卡

	/*-------------钻石流水账状态-------------------*/
	BuyRoomCard        = 1 //买钻石
	HandleTopUp        = 2 //代充钻石
	AutomaticTopUp     = 3 //直充钻石
	TransferCard       = 3 //回充钻石 从游戏帐号里钻石充值到合伙人系统的代理帐号里
	GiveRoomCard       = 4 // 赠送钻石
	ReceiveRoomCard    = 5 //获赠钻石
	SystemGiveRoomCard = 6 //系统赠送

	/*-------------代理提现状态-------------------*/
	WithdrawApproving      = 1 //审批中
	WithdrawApproveSuccess = 2 //审批成功
	WithdrawApproveFail    = 3 //审批失败
	WithdrawPaying         = 4 //支付中
	WithdrawPayFail        = 5 //支付失败
	WithdrawPaySuccess     = 6 //支付成功
	/*-------------金钱流水账状态-------------------*/
	CashWithdrawReturn     = 1 //提现退回
	CashWithdraw           = 2 //提现
	CashBalanceBuy         = 3 //余额买卡
	CashAutomatic          = 4 //玩家直充
	CashLevel2Open         = 5 //下级开店
	CashLevel2Buy          = 6 //下级进货提成
	CashLevel2Automatic    = 7 //下级玩家直充提成
	CashBalanceBuyAgentNum = 8 //余额购买代理名额

	/*-------------合伙人系统的金钱流水账状态-------------------*/
	PfCashWithdrawReturn     = 1 //提现退回
	PfCashWithdraw           = 2 //提现
	PfCashAgentBonus         = 3 //代理提成
	PfCashBalanceBuy         = 4 //余额买卡
	PfCashBalanceBuyAgentNum = 5 //余额购买代理名额

	PfCashAgentCharge = 100 //代理充值

	/*-------------参数设置------------------*/

	RuleLevel1CardPrice  = 1 //一级代理进货类型及单价
	RuleLevel2CardPrice  = 2 //二级代理进货类型及单价
	RulePlayerCardPrice  = 3 //玩家直充进货类型及单价
	AgentGiveCard        = 4 //钻石列表类型及单价
	RulePartnerCardPrice = 5 //合伙人进货类型

	RuleLevel2Open            = 4  //一级收入,下级开店提成
	RuleServerRate            = 5  //提现手续费百分比
	RuleTaxRate               = 6  //提现税费百分比
	RuleMiniWithdrawAmount    = 7  //最小提现金额
	RuleCardNum               = 8  //一级代理每个月应消耗的钻石数量才能考核通过
	RuleAgentNum              = 9  //代理名额
	RulePlayerBindPhone       = 10 //玩家绑定手机赠送钻石
	RulePlayerRegisterDiamond = 11 //玩家注册成功赠送钻石
	RuleClubTableNum          = 12 //默认亲友圈开桌数
	RuleClubMemberNum         = 13 //默认亲友圈成员数
	RulePlayerRegisterCoin    = 14 //玩家注册成功赠送金币
	RulePlayerClubNum         = 15 //每个玩家默认只能开通的亲友圈个数
	RulePlayerClubDiamond     = 16 //每个玩家默认开通的亲友圈最低要求钻石数
	RuleAgentNumPrice         = 17 //代理购买代理名额的单价
	RuleActiveShareApp        = 18 //玩家分享App奖励
	RuleClubFloorNum          = 19 //每个俱乐部最多能创建的楼层数
	RuleGroupBonus            = 20 //大区的提成比例

	RulePfUnitCardPrice = 21 //合伙人进货房卡单价
	RulePfNextBonus     = 22 // 直属下一级提成初始比例
	RulePfNNextBonus    = 23 // 直属下二级提成初始比例

	/*-------------代理开通流程状态------------------*/
	RegisterSuccess   = 0 //注册成功
	AuthCodeSuccess   = 1 //输入授权码成功
	BindPhoneSuccess  = 2 //绑定手机号成功
	VerifyNotPass     = 3 //人工审核不通过
	VerifyPass        = 4 //人工审核通过
	FirstTopUpSuccess = 5 //第一次充值成功

	/*-------------合伙人开通流程状态------------------*/
	PfRegisterSuccess   = 0 //注册成功
	PfBindPhoneSuccess  = 2 //绑定手机号成功
	PfVerifyNotPass     = 3 //人工审核不通过
	PfVerifyPass        = 4 //人工审核通过
	PfFirstTopUpSuccess = 5 //第一次充值成功

	/*-------------事件日志------------------*/
	ModuleSystem = 1 //系统
	ModuleCard   = 2 //钻石
	ModuleCash   = 3 //收入

	EventAgent = 101 //代理开通
	EventPlay  = 102 //游戏服方面

	EventWeChat     = 201 //微信买卡
	EventBalance    = 202 //余额买卡
	EventDelivery   = 203 //发货
	EventCardRecord = 204 //发货记录

	EventBonus = 301 //提成

	/*------------亲友圈成员角色-----------------*/
	ClubRoleNormal = 1 //普通成员
	ClubRoleAdmin  = 2 //管理员
	ClubRoleOwner  = 3 //创建人

	/*-----------亲友圈状态--------------------*/
	ClubNormal  = 1 //正常
	ClubDismiss = 2 //解散
	ClubFrozen  = 3 //冻结

	/*-----------亲友圈成员状态--------------------*/
	ClubMemberAudit  = 1 //待审核状态
	ClubMemberReject = 2 //拒绝
	ClubMemberNormal = 3 //正常
	ClubMemberMute   = 4 //被禁言(被拉黑)
	ClubMemberDelete = 5 //被删除
)
const (
	LOGIN_TYPE_VISITOR  = 0 //游客登录
	LOGIN_TYPE_PHONE    = 1 //手机登录
	LOGIN_TYPE_WECHAT   = 2 //微信登录
	LOGIN_TYPE_XianLiao = 3 //闲聊登录
)

const (
	Success          = 0   //成功
	SuccessTwo       = 200 //也是成功标志
	Fail             = 1   //失败
	ErrSystem        = 500 //系统错误
	ErrDatabase      = 505 //数据库错误
	ErrRetry         = 506 //再次重试
	ErrDatabaseRetry = 507 //数据库连接失效,invalid connection,bad connection

	ErrDecodeParams       = 10  //参数解析错误
	ErrVerifyParams       = 11  //参数检验失败
	ErrConflict           = 12  //数据冲突
	ErrNoData             = 13  //无数据
	ErrCardNotEnough      = 14  //钻石不足
	ErrCashNotEnough      = 15  //余额不足
	ErrAgentInactive      = 16  //代理未激活
	ErrWeChatAlreadyBind  = 17  //此微信已经绑定了其它帐号
	ErrLotteryNotEnough   = 18  //抽奖次数不足
	ErrAlreadyLogin       = 401 //此帐号已经在其它地方登录
	ErrClientAlreadyLogin = 101 //客户端帐号已经在其它地方登录
	ErrWeChatLoginFail    = 102 //客户端微信帐号登录失败,访问微信返回的信息为空
	ErrAgentNumNotEnough  = 19  //一代理的名额不足
	ErrOperationRepeat    = 20  //此动作已经重复操作了
	ErrOrderNotPaySuccess = 21  //订单未支付成功

	ErrRoleAlreadyExist     = 398 //角色已经存在
	ErrUserAlreadyExist     = 399 //用户已经存在
	ErrUserOrPassword       = 400 //用户或密码错误
	ErrUserUnauthorized     = 401 //用户未登录
	ErrCaptchaVerify        = 402 //短信验证码检验不通过
	ErrUserForbidden        = 403 //无权限
	ErrNotFound             = 404 //不存在
	ErrAlreadyExist         = 405 //已经存在
	ErrUserFrozen           = 406 //用户被冻结
	ErrUserPassword         = 407 //修改密码时使用，用户密码错误
	ErrUserPhone            = 408 //修改密码时使用，用户密码错误
	ErrAuthCodeAlreadyUse   = 409 //授权码已经被使用
	ErrAuthCodeCantGenToday = 410 //授权码每天只能生成一次
	ErrAgentBankUpdate      = 411 //银行信息每月只能修改一次
	ErrRunningMode          = 412 //运行模式错误
	ErrServerStop           = 413 //服务器维护中
	ErrDisableAgent         = 414 //不能发展下级代理
	ErrPlayerNotExist       = 415 //玩家不存在，请先下载游戏成为玩家才能成为合伙人系统的代理
)

const (
	MsgSuccess              = "成功"
	MsgFail                 = "失败"
	MsgErrDecodeParams      = "参数解析错误"
	MsgLoginSuccess         = "登录成功"
	MsgLoginFail            = "登录失败"
	MsgErrUserUnauthorized  = "用户未登录,请登录"
	MsgErrUserAlreadyExist  = "用户已经存在"
	MsgErrUserExpire        = "用户信息已过期,请重新登录"
	MsgErrAlreadyLogin      = "此帐号已经在其它地方登录"
	MsgErrUserForbidden     = "无权限"
	MsgErrUserOrPassword    = "用户名或密码错误"
	MsgErrPhoneOrPassword   = "手机号或密码错误"
	MsgErrUserNotFound      = "用户不存在"
	MsgErrOrderNotFound     = "此订单不存在"
	MsgErrWithdrawNotFound  = "此提现记录不存在"
	MsgErrPhoneAlreadyExist = "此手机号已被注册"
	MsgErrPhoneAlreadyBind  = "此手机号已被绑定"
	MsgErrUserFrozen        = "用户被冻结:"
	MsgErrUserPassword      = "密码错误"
	MsgErrUserPhone         = "手机号错误"
	MsgErrAgentInactive     = "代理未激活,不能赠送"
	MsgErrAgentNumNotEnough = "代理名额不足,请联系推广员"

	MsgErrSystem      = "系统繁忙,请稍后重试"
	MsgErrDatabase    = "系统繁忙,请稍后重试"
	MsgErrRunningMode = "运行模式错误"
	MsgErrLoginRetry  = "系统繁忙,请稍候重试"

	MsgErrNoData            = "无数据"
	MsgErrGiveCard          = "赠送钻石数量不存在"
	MsgErrCardNotEnough     = "钻石不足"
	MsgErrCashNotEnough     = "余额不足"
	MsgErrCardNoExist       = "购买的钻石不存在"
	MsgErrOrderNoExist      = "订单不存在"
	MsgErrSyncWeChat        = "不是本帐号绑定的微信不能同步"
	MsgErrWeChatAlreadyBind = "此微信已经绑定了其它帐号"
	MsgErrAgentBankUpdate   = "银行信息每月只能修改一次"

	MsgErrRoleAlreadyExist = "此角色名已经存在"

	MsgErrCaptchaVerify       = "短信验证码检验不通过"
	MsgErrCaptchaAlreadyExist = "短信验证码已发送,无需重复发送"
	MsgErrCaptchaSend         = "短信验证码发送失败"

	MsgErrStartTimeOverEndTime = "开始时间不能大于结束时间"

	MsgErrEmailNotFound = "邮件未找到"

	MsgErrAuthCodeNotFound    = "授权码不存在"
	MsgErrAuthCodeAlreadyUsed = "授权码已被使用"

	MsgErrUserStatus       = "用户状态错误"
	MsgUserNotRegister     = "用户未注册"
	MsgUserNotBindAuthCode = "用户未输入授权码"
	MsgUserNotBindPhone    = "用户未绑定手机号"
	MsgUserNotPass         = "用户未通过审核,无权限"
	MsgUserNotCharge       = "用户未充值购卡"

	MsgAuthCodeCantGenToday = "授权码每天只能生成一次"
	MsgAuthCodeConflict     = "授权码冲突,请重试"

	MsgErrCardNotFound     = "暂时未有钻石出售"
	MsgAlreadyDeliveryCard = "此订单已发货,不能重复发货"
	MsgOrderNotPaySuccess  = "未支付成功,不能发货"

	MsgDatabaseBusy = "系统繁忙,请稍后重试"
)

var (
	MsgErrRoleAlreadyBind = errors.New("此角色已被用户绑定,不能删除")
	MsgErrDataNotFound    = errors.New("无数据")
	MsgErrOnly100DayQuery = errors.New("只支持查询连接100天")
	MsgAgentAlreadyFormal = errors.New("已是正式代理,不能再修改状态")

	MsgRoleNoPermission = errors.New("用户角色未配置权限")

	MsgErrDataBase = errors.New("系统繁忙")
	MsgErrGame     = errors.New("游戏服返回错误")

	MsgUserPlaying = errors.New("玩家正在游戏中,不可修改")

	ErrInvalidConn    = errors.New("invalid connection")
	ErrBadConnNoWrite = errors.New("bad connection")
)
